package com.um.swing.component;

import com.um.swing.MainView;
import com.um.swing.common.inc.Config;
import com.um.swing.common.inc.Constant;
import com.um.swing.ui.*;

import javax.swing.*;
import javax.swing.border.EmptyBorder;
import java.awt.*;
import java.io.IOException;
import java.net.URISyntaxException;

/**
 * 名称：意见反馈
 * 创建人：袁泉
 * 创建时间：2022年05月11日20:25:15
 */
public class TabFeedbackPanel extends Panel {
    private static final long serialVersionUID = 5417989883734105715L;
    public static Object LOCK = new Object();
    private JButton jBtn;


    public TabFeedbackPanel(MainView jMainView) {
        this.setLayout(new BorderLayout());
        initUI();
        this.bindEvent();
    }

    private void initUI() {
        JPanel panel = new JPanel();
        panel.setBackground(Constant.MAIN_BG_COLOR);
        panel.setBorder(new EmptyBorder(200, 0, 0, 0));
        jBtn = new JButton("点击进入古书网反馈");
        jBtn.setUI(new IButtonUI(new Dimension(200, 80), null));
        jBtn.setPreferredSize(new Dimension(200, 80));
        panel.add(jBtn);
        this.add(panel, BorderLayout.CENTER);
    }

    private void bindEvent() {
        jBtn.addActionListener(t -> {
            try {
                Desktop.getDesktop().browse(new java.net.URI("https://gushu.net.cn/index.php/qun/show-56.html#s=jianpinclient"));
            } catch (IOException e) {
                e.printStackTrace();
            } catch (URISyntaxException e) {
                e.printStackTrace();
            }
        });
    }
}
